home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 01 New Uploads / N!.SDA / N!-APPROX (.txt) next >
Encoding:
Commodore BASIC  |  2019-04-13  |  584 b   |  23 lines

  1. 10 POKE55,.:POKE56,160:CLR:PRINT"[147]"
  2. 15 B=29:N=-1:PRINT"ENTER INTEGER (0 TO 999)."
  3. 17 INPUTN:X$=MID$(STR$(N),2):PRINT:IFN=-1THENEND
  4. 20 PRINTX$;"! =";:IFN>33THEN30
  5. 22 IFN=.ORN=1THENPRINT1:PRINT:GOTO15
  6. 25 A=1:FORI=2TON:A=A*I:NEXT:PRINTA:PRINT:GOTO15
  7. 30 A=1:FORI=2TO29:A=A*I:NEXT:Y$=STR$(A):M=VAL(LEFT$(Y$,LEN(Y$)-4))
  8. 35 E=VAL(RIGHT$(Y$,3))
  9. 40 B=B+10:IFB>NTHEN55
  10. 45 C=1:FORI=B-9TOB:C=C*I:NEXT:X$=MID$(STR$(C),2)
  11. 50 M=M*VAL(LEFT$(X$,LEN(X$)-4)):E=E+VAL(RIGHT$(X$,3))
  12. 52 IFM=>10THENM=M/10:E=E+1:GOTO52
  13. 53 GOTO40
  14. 55 IFB=N+10THEN70
  15. 60 C=1:FORI=B-9TON:C=C*I:NEXT:X$=STR$(C)
  16. 61 IFASC(RIGHT$(X$,4))<>69THEN85
  17. 63 E=E+VAL(RIGHT$(X$,3))
  18. 65 M=M*VAL(LEFT$(X$,LEN(X$)-4))
  19. 70 IFM=>10THENM=M/10:E=E+1:GOTO70
  20. 75 X$=STR$(M)+"E+"+MID$(STR$(E),2)
  21. 80 PRINTX$:PRINT:GOTO15
  22. 85 M=M*VAL(X$):GOTO70
  23.